//Accepted
#include <cstdio>
#include <cstring>

int  t, g, a[301], i, j, m, x;
char mm[1000000], ok;
int main(){
	//freopen("in.txt","r",stdin);

	scanf("%d", &t);
	while(t--){
		scanf("%d", &g);
		for(i=0;i<g;++i)scanf("%d", &a[i]);
		m=g-1;
		ok=0;
		while(!ok){
			memset(mm,1,sizeof mm);
			++m;
			ok=1;
			for(i=0;i<g;++i){
				x=a[i]%m;
				if(mm[x])mm[x]=0;
				else ok=0;
			}
		}

		printf("%d\n", m);

	}
	return 0;
}
